using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;


namespace myGame
{
    public class Moveable : Microsoft.Xna.Framework.DrawableGameComponent
    {
        protected Texture2D texture;
        protected int x;
        protected int y;
        protected int vitesse;
        protected Rectangle rectangle;

        public Moveable(Game game)
            : base(game)
        {
            rectangle = new Rectangle(0, 0, 0, 0);
        }

        public Moveable(Game game, int _x, int _y, int _v)
            : base(game)
        {
            x = _x;
            y = _y;
            rectangle = new Rectangle(x, y, 0, 0);
            vitesse = _v;
        }

        public Moveable(Game game, int _x, int _y)
            : base(game)
        {
            x = _x;
            y = _y;
            rectangle = new Rectangle(x, y, 0, 0);
        }

        public int getX()
        {
            return x;
        }
        public int getY()
        {
            return y;
        }
        public Rectangle getRectangle()
        {
            return this.rectangle;
        }
        public int getV()
        {
            return vitesse;
        }
        public Texture2D getTexture()
        {
            return texture;
        }

        public void setX(int _x)
        {
            x = _x;
        }
        public void setY(int _y)
        {
            y = _y;
        }
        public void setV(int _v)
        {
            vitesse = _v;
        }
        public void setRectangle(Rectangle rec)
        {
            this.rectangle = rec;
        }
        public void setRectangle(int _x, int _y, int _w, int _h)
        {
            this.rectangle = new Rectangle(_x, _y, _w, _h);
        }

        public override void Initialize()
        {
            base.Initialize();
        }

        public override void Update(GameTime gameTime)
        {
            
            base.Update(gameTime);
        }

        public bool isOnBoard()
        {
            return (x <= 0 || y <= 0 || x >= GraphicsDevice.Viewport.Width - texture.Width ||
                y >= GraphicsDevice.Viewport.Width - texture.Height);
        }

    }
}
